<?php

// +----------------------------------------------------------------------
// | Author: pp <124910168@qq.com>
// +----------------------------------------------------------------------

/**
 * 店铺类别模型
 */
namespace app\common\model;
use think\Db;

class StoreClass extends BaseModel {

//  public function __construct(){
//      parent::__construct('store_class');
//  }

    /**
     * 取店铺类别列表
     * @param unknown $condition
     * @param string $pagesize
     * @param string $order
     */
    public function getStoreClassList($condition = array(), $page = 1, $pageSize = 20, $order = 'sc_sort asc,sc_id asc') {

        return $this->where($condition)->order($order)->page($page, $pageSize)->select();
    }

    /**
     * 取得单条信息
     * @param unknown $condition
     */
    public function getStoreClassInfo($condition = array()) {
        return $this->where($condition)->find();
    }
    
    /**
     * 取得分类单个字段
     * @param unknown $condition
     */
    public function getStoreClassName($condition = array(),$value='sc_name') {
        return $this->where($condition)->value($value);
    }

    /**
     * 删除类别
     * @param unknown $condition
     */
    public function delStoreClass($condition = array()) {
        return $this->where($condition)->delete();
    }

    /**
     * 增加店铺分类
     * @param unknown $data
     * @return boolean
     */
    public function addStoreClass($data) {
        return $this->insert($data);
    }

    /**
     * 更新分类
     * @param unknown $data
     * @param unknown $condition
     */
    public function editStoreClass($data = array(),$condition = array()) {
        return $this->where($condition)->update($data);
    }
}
